<%@page import="ctm.javacode.classificationfood"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.ArrayList"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>中醫體質評量系統</title>
<script language="Javascript" type="text/javascript" >
var clickstr = null;
function showAlltable() {
	document.getElementById("r1").className = "on";
	document.getElementById("r2").className = "on";
	document.getElementById("r3").className = "on";
	document.getElementById("r4").className = "on";
	document.getElementById("r5").className = "on";
	document.getElementById("r6").className = "on";
	document.getElementById("r7").className = "on";
}
function hideAlltable() {
	document.getElementById("r1").className = "off";
	document.getElementById("r2").className = "off";
	document.getElementById("r3").className = "off";
	document.getElementById("r4").className = "off";
	document.getElementById("r5").className = "off";
	document.getElementById("r6").className = "off";
	document.getElementById("r7").className = "off";
}
function showtabel(onclick) {
	//將所有食物的tabel設為隱藏
	hideAlltable();
	clickstr = onclick;
	var str = onclick;
	document.getElementById("prints").className = "on";
	document.getElementById(str).className = "on";
}
function printout() {
	if (!window.print){alert("列印功能暫時停用，請按 Ctrl-P 來列印"); return;}
	showAlltable();
	document.getElementById("prints").className = "noprint";
	window.print();
	showtabel(clickstr);
}
function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}
</script>
<style type="text/css">
body,td,th {
	color: #000000;
	font-size: 20px;
	font-family: "標楷體";
}

.HEAD_STYLE {
	font-weight: bold;
	color: #437A27;
	font-family: "標楷體";
	font-size: 30px;
}

span {
	color: #000000;
	font-size: 24px;
	font-family: "標楷體";
	font-weight: bold;
}

.button {
	border: 1px;
	padding-top: 4px;
	padding-right: 7px;
	padding-bottom: 4px;
	padding-left: 7px;
	background-color: #468129;
	color: #FFFFFF;
	font-size: 16px;
	border-color: #3C7023;
}

.off {
	display: none
}

.on {
	display: block;
}
.noprint {display:none}
</style>
</head>
<body>
	<div width="80%" align="center">
		<%		
		ArrayList<ArrayList<String>> whole_grain_Suit = new ArrayList<ArrayList<String>>(); // 全穀根莖類
		ArrayList<ArrayList<String>> meat_Suit = new ArrayList<ArrayList<String>>(); // 豆魚肉蛋類
		ArrayList<ArrayList<String>> fat_Suit = new ArrayList<ArrayList<String>>(); // 油脂及堅果種子類
		ArrayList<ArrayList<String>> milk_Suit = new ArrayList<ArrayList<String>>(); // 低脂奶類
		ArrayList<ArrayList<String>> fruit_Suit = new ArrayList<ArrayList<String>>(); // 水果類
		ArrayList<ArrayList<String>> vegetables_Suit = new ArrayList<ArrayList<String>>(); // 蔬菜類
		ArrayList<ArrayList<String>> other_Suit = new ArrayList<ArrayList<String>>(); // 其他類		
		
		String ac;
		if (request.isUserInRole("admin") || request.isUserInRole("professional") ){				
			ac = (String) session.getAttribute("login")+";nopersonId"; //nopersonId為未輸入身分證字號
		}else{
			ac = (String) session.getAttribute("login");
		}
		classificationfood _classificationfood = new classificationfood(ac);
		whole_grain_Suit = _classificationfood.getsuitfood("全穀根莖類");
		meat_Suit = _classificationfood.getsuitfood("豆魚肉蛋類");
		fat_Suit = _classificationfood.getsuitfood("油脂及堅果種子類");
		milk_Suit = _classificationfood.getsuitfood("低脂奶類");
		fruit_Suit = _classificationfood.getsuitfood("水果類");
		vegetables_Suit = _classificationfood.getsuitfood("蔬菜類");
		other_Suit = _classificationfood.getsuitfood("其他類");
		%>

		<span align="center" class="HEAD_STYLE">可用食物</span>
		<hr>
		<div align="center" id="div">
			<a href="javascript:showtabel('r1')">全穀根莖類</a> &nbsp; 
			<a href="javascript:showtabel('r2')">豆魚肉蛋類</a> &nbsp; 
			<a href="javascript:showtabel('r3')">油脂及堅果種子類</a> <br>&nbsp; 
			<a href="javascript:showtabel('r4')">低脂奶類</a> &nbsp; 
			<a href="javascript:showtabel('r5')">水果類</a> &nbsp; 
			<a href="javascript:showtabel('r6')">蔬菜類</a> &nbsp; 
			<a href="javascript:showtabel('r7')">其他類</a> &nbsp; 
		</div>
		<hr>

		<table align="center" class="off" id="r1" border="1">
			<col style="width:40%">
			<tr>
			<td align="left" valign="top">
			<div align=center><span>全穀根莖類</span><br></div>
			<%=_classificationfood.webpublish(whole_grain_Suit) %>
			</td>			
			</tr>
		</table>

		<table align="center" class="off" id="r2" border="1">
			<col style="width:40%">
			<tr>
			<td align="left" valign="top">
			<div align=center><span>豆魚肉蛋類</span><br></div>
			<%=_classificationfood.webpublish(meat_Suit) %>
			</td>
			</tr>
		</table>

		<table align="center" class="off" id="r3" border="1">
			<col style="width:40%">
			<tr>
			<td align="left" valign="top">
			<div align=center><span>油脂及堅果種子類</span><br></div>
			<%=_classificationfood.webpublish(fat_Suit) %>
			</td>
			</tr>
		</table>

		<table align="center" class="off" id="r4" border="1">
			<col style="width:40%">
			<tr>
			<td align="left" valign="top">
			<div align=center><span>低脂奶類</span><br></div>
			<%=_classificationfood.webpublish(milk_Suit) %>
			</td>
			</tr>
		</table>

		<table align="center" class="off" id="r5" border="1">
			<col style="width:40%">
			<tr>
			<td align="left" valign="top">
			<div align=center><span>水果類</span><br></div>
			<%=_classificationfood.webpublish(fruit_Suit) %>
			</td>
			</tr>
		</table>

		<table align="center" class="off" id="r6" border="1">
			<col style="width:40%">
			<tr>
			<td align="left" valign="top">
			<div align=center><span>蔬菜類</span><br></div>
			<%=_classificationfood.webpublish(vegetables_Suit) %>
			</td>
			</tr>
		</table>

		<table align="center" class="off" id="r7" border="1">
			<col style="width:40%">
			<tr>
			<td align="left" valign="top">		
			<div align=center><span>其他類</span><br></div>
			<%=_classificationfood.webpublish(other_Suit) %>
			</td>
			</tr>
		</table>
		<a id="prints" href="javascript:printout()">列印本頁</a>
	</div>
</body>
</html>